require(['jquery', 'cookie', 'app', 'lay','base64','jsPdf'], function ($) {
    require(['vue'], function (Vue) {
        var dic = new Vue({
            el: ".vue-box"
            , data: {
                th: {},
                shopItem:[],
                saleItem:[],
            }
            , created: function () {
                this.loadPage()
            }
            , methods: {
                loadPage: function () {
                    debugger;
                    var jon={};
                    jon['uuid']=new acquire().parameterMap['uuid'];
                    var re = playAjax("OrderController/GetOrderById",jon);
                    this.th=re.data.order;
                    this.shopItem=re.data.item;
                    this.saleItem=re.data.sale;
                    re =[
                        {
                            "field":"numbers",
                            "title":"序号",
                            "type":"numbers"
                            ,"width":"80"
                            ,totalRowText: '合计'
                        },
                        {
                            "field":"sepceName",
                            "templet":"#sepceName",
                            "title":"产品"
                            ,"width":"150"
                        },
                        {
                            "field":"color",
                            "templet":"#color",
                            "title":"颜色"
                            ,"width":"150"
                        },
                        {
                            "field":"count",
                            "title":"数量"
                            ,"width":"150"
                            ,totalRow: true
                        },
                        {
                            "templet":"#price",
                            "field":"price",
                            "title":"单价"
                            ,"width":"150"
                        },
                        {
                            "field":"money",
                            "title":"金额"
                            ,"width":"150"
                            ,totalRow: true
                        }
                    ]
                    var toolbar=[];
                    layui.use('table', function() {
                        var table = layui.table;
                        table.render({
                            elem: '#tabXXTT'
                            , url: "/" + configPro.projectName + "/OrderController/GetOrderItem" //数据接口
                            , method: "POST"
                            , contentType: "application/json"
                            , cols: [re]
                            ,totalRow: true
                            , parseData: function (res) { //res 即为原始返回的数据
                                return {
                                    "code": res.code, //解析接口状态
                                    "msg": res.msg, //解析提示文本
                                    "count": res.num, //解析数据长度
                                    "data": res.data //解析数据列表
                                };
                            }, done: function () {
                            }
                            , where: {
                                common: {
                                    shopOrder:{uuid:new acquire().parameterMap['uuid']}
                                },
                                limit:1000
                            }
                            , loading: true
                        });
                    })
                },
                dy:function () {
                    var userAgent = navigator.userAgent.toLowerCase(); //取得浏览器的userAgent字符串
                    if (userAgent.indexOf("trident") > -1){
                        alert("请使用google或者360浏览器打印");
                        return false;
                    }else if(userAgent.indexOf('msie')>-1){
                        var onlyChoseAlert = simpleAlert({
                            "content":"请使用Google或者360浏览器打印",
                            "buttons":{
                                "确定":function () {
                                    onlyChoseAlert.close();
                                }
                            }
                        })
                        alert("请使用google或者360浏览器打印");
                        return false;
                    }else{
                        $("#dj").hide();
                        $(".dy").hide();
                        window.print();
                        $("#dj").show();
                        $(".dy").show();
                    }
                }
            }
        });
    });
});

